package com.fantasy.easy.biz.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fantasy.easy.biz.domain.BizEmployee;
import com.fantasy.easy.biz.service.BizEmployeeService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author sdehua-帅德华
 * @Email sdhstart@qq.com
 * @Date 2022/6/24 14:47
 * @Version 1.0
 **/
@RestController
@RequestMapping("employee")
public class BizEmployeeController {

    @Resource
    BizEmployeeService bizEmployeeService;

    @GetMapping("info")
    public IPage<BizEmployee> getInfo(@RequestBody(required = false) BizEmployee bizEmployee, Page<BizEmployee> p){
        return bizEmployeeService.queryAll(bizEmployee,p);
    }

    @PostMapping("add")
    public int addInfo(@RequestBody BizEmployee bizEmployee){
        return bizEmployeeService.insert(bizEmployee);
    }

    @DeleteMapping("delete")
    public boolean deleteEmployee(@RequestBody Map<String,Integer> map){
        return bizEmployeeService.removeById(map.get("userId"));
    }


}
